'''
Created on 2012-10-8

@author: jezhang
'''


from django.contrib import admin
from djbook2.books.models import Publisher,Author,Book
from django.contrib.admin.templatetags.admin_list import date_hierarchy

class AuthorAdmin(admin.ModelAdmin):
    list_display = ('first_name', 'last_name', 'email')
    search_fields = ('first_name', 'last_name')

class BookAdmin (admin.ModelAdmin):
    list_display = ('title', 'publisher', 'publication_date')
    list_filter = ('publication_date',)
    date_hierarchy = 'publication_date'
    ordering = ('-publication_date',)
    filter_horizontal = ('authors',)
    fields = ('title', 'authors', 'publisher', 'publication_date')
    raw_id_fields = ('publisher',)

admin.site.register(Publisher)
admin.site.register(Author, AuthorAdmin)
admin.site.register(Book, BookAdmin)

